const mongoose = require('mongoose')

const Schema = mongoose.Schema

const artitalkSchema = new Schema({
  username: {
    type: String,
    default:''
  },
  avatar: {
    type: String,
    default:'https://www.ipicbed.com/images/2021/12/23/avater02.th.jpg'
  },
  role: {
    type: String,
    default:'normal'
  },
  user_id: {
    type: String,
    default:''
  },
  created_time: {
    type: Date,
    default: Date.now
  },
  last_modified_time: {
    type: Date,
    default: Date.now
  },
  content: {
    type: String,
    default:''
  }
})

// const Artitalk = mongoose.model('Artitalk',artitalkSchema)

// Artitalk.create({
//   username: "feng",
//   avatar:'https://www.ipicbed.com/images/2021/12/23/avater02.th.jpg',
//   role: "admin",
//   user_id: "62035bbd8395411ae48e3176",
//   created_time:new Date,
//   last_modified_time: new Date,
//   content: "第一次评论"
// }).then((res) => {
//   console.log('创建成功');
// }).catch((err) => {
//   console.log('创建失败');
// });

module.exports = mongoose.model('Artitalk', artitalkSchema)